package com.card.server.domain;

import lombok.Data;

import java.util.*;

/**
 * @author TISNIW
 * @version 1.0
 * @date 2025/5/26 8:25
 * @desc
 */
@Data
public class Room {
    private String roomId;
    private Integer gameType;
    private Integer tableType;
    private List<Player> players; // 玩家列表
    private Integer status;           // 房间状态：1-等待中，2-游戏中，3-已结束
    private Long createdAt;          // 创建时间

    private boolean isStarted = false;
    private int landlordIndex = -1; // 地主索引
    private List<Integer> cards = new ArrayList<>(); // 所有牌
    private Map<Integer, List<Integer>> playerCards = new HashMap<>(); // 每个玩家的手牌
    private int currentPlayerIndex = 0; // 当前轮到谁出牌
    private Stack<List<Integer>> lastPlayedCards = new Stack<>(); // 上一手牌

    public Room(String roomId, Integer gameType, Integer tableType, List<Player> players) {
        this.roomId = roomId;
        this.gameType = gameType;
        this.tableType = tableType;
        this.players = players;
        this.status = 1;
        this.createdAt = System.currentTimeMillis();
    }
}
